package com.wyz.note.project.knife4j.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.wyz.note.project.knife4j.pojo.UserInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @Description:
 * @Author: wei yz
 * @Date: 2022/6/26 14:36
 */
@Api(tags = "用户模块", value = "用户模块")
@RequestMapping("/userInfo")
@RestController
public class UserInfoController {

    @GetMapping("/info")
    @ApiImplicitParam(name = "name", value = "测试", required = true)
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "输入用户名查询")
    public ResponseEntity<String> sayHi(@RequestParam(value = "name") String name) {
        return ResponseEntity.ok("Hi:" + name);
    }


    @PostMapping("/add")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "添加", httpMethod = "POST")
    public ResponseEntity<String> add(@RequestBody @ApiParam(value = "用户实体表单", required = true) UserInfo userInfo) {
        return ResponseEntity.ok("添加:" + userInfo);
    }
}
